<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateNetworkExpressTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('network_express', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('service_id')->index()->comment('服务站id');
            $table->unsignedInteger('network_id')->index()->comment('网点id');
            $table->unsignedTinyInteger('status')->default(1)->comment('1:正常  2：已解除');
            $table->decimal('credit', 10, 2)->default(0.00)->comment('信用额度');
            $table->decimal('unit_price', 10, 2)->default(0.00)->comment('单价   元/件');
            $table->unsignedInteger('total_entry')->default(0)->comment('入库(件)');
            $table->unsignedInteger('total_sign')->default(0)->comment('签收(件)');
            $table->decimal('total', 10, 2)->default(0.00)->comment('合计');
            $table->decimal('total_settlement', 10, 2)->default(0.00)->comment('历史结算');
            $table->string('region_mark')->nullable()->comment('备注');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('network_express');
    }
}
